package com.bbx.taxi.client.Bean;

import android.content.Context;
import android.os.Environment;

import com.bbx.androidapi.util.SharedPreUtil;
import com.bbx.api.util.SharedPreEncryptUtil;
import com.bbx.taxi.client.Bean.Attribute.MainAttribute;
import com.bbx.taxi.client.Util.ToCity2;

import java.io.File;
import java.util.ArrayList;
import java.util.List;

/**
 * 固定值
 */
public class Value {
	/**判断是否是新版本*/
	public static boolean isNEW=false;
	/**加载框几毫秒内不能弹出来*/
	public static final int LOADDIALOGTIME=500;
	public final static int isNormal = 0;
	public final static int isBaidu = 1;
	public final static int is360 = 2;
	/**
	 * 0为正在版本 1为百度， 2为360
	 */
	public static int isMode = isNormal;

	public static List<String> list_line = new ArrayList<String>();
	public static List<String> list_line_cn = new ArrayList<String>();
	public static String BBX_FIELS = "bbxpc";
	public static String SD_PATH = getSDCardPath() + File.separator;
	public static String BBX_PATH = SD_PATH + BBX_FIELS + File.separator;
	public static String SDK_PATH = BBX_PATH + "sdklog.txt";
	public static String APK_PATH = BBX_PATH + "apk" + File.separator;
	public static String need_fetch_pic = "";
	//app刚启动的的城市
	public static String appCity=null;
	/** 判断SDK是否有重启登陆过 */
	public static boolean isUnSDK = false;
	public static String now_time = "现在出发";
	public static boolean isActive = true;
	public static int maxorder = 1000;
	public final static String pathSavedDir = Environment
			.getExternalStorageDirectory().getAbsolutePath() + "/downloads/";
	/** 开发 */
	// public final static String mtid="SLMT_1441589221";
	/** 测试 */
	public final static String mtid = "SLMT_1441607074";
	// public final static String mtid="SLMT_1441607152";
	// public final static String mtid="SLMT_1441607159";
	// public final static String mtid="SLMT_1441607175";
	// public final static String mtid="SLMT_1441607164";
	// public final static String mtid="SLMT_1441607169";
	/** 分享类型 */
	public final static String TYPE_RECOMMEN = "1";// 推荐
	public final static String TYPE_SHARE = "2";// 分享

	public static String TEL_KF = "02895170";
	public static String TEL_TSX = "0991 3871111";
	public static int ThanksFeeMax = 50;
	// 订单状态
	/** 未处理 */
	public final static int ORDER_STATUS_UNTREATED = 0;
	/** 已入队列 */
	public final static int ORDER_STATUS_TEAM = 1;
	/** -已指派 */
	public final static int ORDER_STATUS_ASSiIGN = 2;
	/** -重新调度入队列 */
	public final static int ORDER_STATUS_RETEAM = 3;
	/** -已上车 */
	public final static int ORDER_STATUS_ONCAR = 4;
	/** -已下车，就是待支付界面 */
	public final static int ORDER_STATUS_OFFCAR = 10;
	/** -已完成 */
	public final static int ORDER_STATUS_FINISH = 100;
	/** 订单取消 */
	public final static int ORDER_STATUS_CANCEL = 20;
	/** 订单取消 */
	public final static int ORDER_STATUS_KF_CANCEL = 23;
	/** 订单改派 */
	public final static int ORDER_STATUS_GAIPAI = 21;
	/** 订单改派然后又被取消 */
	public final static int ORDER_STATUS_GAIPAI_CANCEL = 22;
	/** 客服改派 */
	public final static int ORDER_STATUS_KF_GAIPAI = 24;
	/** -客户删除 */
	public final static int ORDER_STATUS_DELETE = 200;

	// 订单评价状态
	/** 待评价 */
	public final static int VALUATE_STATUS_NO = 1;
	/** 已评价 */
	public final static int VALUATE_STATUS = 2;

	// 订单类型，0拼车，1包车，2快件
	public final static int ORDER_TYPE_PC = 0;
	public final static int ORDER_TYPE_BC = 1;
	public final static int ORDER_TYPE_KJ = 2;
	public final static int ORDER_TYPE_SN = 3;
	public final static int ORDER_ORIGIN = 99;// 爱心直通车
	public final static int ORDER_ORIGIN_SF = 98;// 顺风车

	// 主界面的顺序，0为室内,1为拼车，2为包车,3快件
	public final static int VIEWID_SN = 0;
	public final static int VIEWID_PC = 1;
	// public final static int VIEWID_BC=100;
	public final static int VIEWID_KJ = 2;

	// 地址类型
	public final static String ADDRESS_TYPE_COLLECTE = "1";
	public final static String ADDRESS_TYPE_HISTORY = "0";
	// 联系类型
	public final static String CONTACTS_TYPE_COLLECTE = "1";
	public final static String CONTACTS_TYPE_HISTORY = "0";

	// 快件的值
	public final static int KJ_WEIGHT_0_5 = 1;
	public final static int KJ_WEIGHT_6_10 = 2;
	public final static int KJ_WEIGHT_11_15 = 3;
	public final static int KJ_VOLUME_S = 1;
	public final static int KJ_VOLUME_M = 2;
	public final static int KJ_VOLUME_B = 3;

	// 消息的已读跟未读
	public final static String MSG_READ = "1";
	public final static String MSG_UNREAD = "0";

	// 城市是否具体地址
	public final static String CITY_DETAIL = "1";
	public final static String CITY_NODETAIL = "0";

	// 是否是市内城市
	public final static String CITY_INCITY = "1";
	public final static String CITY_NOINCITY = "0";

	// 是否显示
	public final static String CITY_SHOW = "0";
	public final static String CITY_NOSHOW = "1";

	// 判断室内城市是APP下单还是电话下单
	public final static String CITY_APP = "1";
	public final static String CITY_TEL = "2";
	/** 城市已地址的分隔符 */
	public final static String CITY_SPILT = " ";

	/**
	 * 获取SDCard路径
	 * 
	 * @return SDCard路径
	 */
	public static String getSDCardPath() {
		// 判断SdCard是否存在并且是可用的
		if (ExistSDCard()) {
			return Environment.getExternalStorageDirectory().toString();
		} else {
			return null;
		}
	}

	public static boolean ExistSDCard() {
		if (android.os.Environment.getExternalStorageState().equals(
				android.os.Environment.MEDIA_MOUNTED)) {
			return true;
		} else
			return false;
	}

	/**
	 * 判断是否是成都
	 */
	public static boolean isChengDu() {
		MainAttribute main = MainAttribute.getInstance();
		if (ToCity2.getCityName(main.getStartCity()).equals("成都")
				|| ToCity2.getCityName(main.getEndCity()).equals("成都")
				||ToCity2.getCityName(main.getStartCity()).equals("眉山")
				|| ToCity2.getCityName(main.getEndCity()).equals("眉山")) {
			return true;
		}
		return false;
	}

	/**
	 * 判断定位城市是否是成都
	 */
	public static boolean isLocationChengdu(Context context) {
		String city = SharedPreUtil.getStringValue(context,
				SharedPreEncryptUtil.locationcity, "");
		if (ToCity2.getCityName(city).equals("成都")) {
			return true;
		}
		return false;
	}
	/**
	 * 判断定位城市是呼和浩特
	 */
	public static boolean isLocationHuhehaote(Context context) {
		String city = SharedPreUtil.getStringValue(context,
				SharedPreEncryptUtil.locationcity, "");
		if (ToCity2.getCityName(city).equals("呼和浩特")) {
			return true;
		}
		return false;
	}
	/**
	 * 判断定位城市是否是新疆
	 */
	public static boolean isLocationXinJiang(Context context) {
//		String province = SharedPreUtil.getStringValue(context,
//				SharedPreEncryptUtil.locationprovince, "");
//		if (province.startsWith("新疆")) {
//			return true;
//		}
		return false;
	}

	/**
	 * 判断定位城市是否是四川
	 */
	public static boolean isLocationSichuan(Context context) {
		String province = SharedPreUtil.getStringValue(context,
				SharedPreEncryptUtil.locationprovince, "");
		if (province.startsWith("四川")) {
			return true;
		}
		return false;
	}
}
